﻿using System;
using System.Data.SqlClient;

namespace RxjhServer.DbClss
{
	public class DbPoolClass
	{
		private string conn;

		private SqlParameter[] prams;

		private int type;

		private string sql;

		public static int DbPoolClassRun(string SqlConnection, string procName, SqlParameter[] prams, int Type)
		{
			int result;
			try
			{
				SqlConnection sqlConnection = new SqlConnection(SqlConnection);
				if (Type == 1)
				{
					if (SqlDBA.RunProcSql(sqlConnection, procName, prams) == -1)
					{
						if (World.jlMsg == 1)
						{
							Form1.WriteLine(0, procName);
						}
						result = -1;
					}
					else
					{
						result = 0;
					}
				}
				else if (SqlDBA.RunProc(sqlConnection, procName, prams) == -1)
				{
					if (World.jlMsg == 1)
					{
						Form1.WriteLine(0, procName);
					}
					result = -1;
				}
				else
				{
					result = 0;
				}
			}
			catch (Exception arg)
			{
				Form1.WriteLine(1, "DbPoolClassRun出错" + arg);
				result = -1;
			}
			return result;
		}

		public string Conn
		{
			get
			{
				return this.conn;
			}
			set
			{
				this.conn = value;
			}
		}

		public SqlParameter[] Prams
		{
			get
			{
				return this.prams;
			}
			set
			{
				this.prams = value;
			}
		}

		public int Type
		{
			get
			{
				return this.type;
			}
			set
			{
				this.type = value;
			}
		}

		public string Sql
		{
			get
			{
				return this.sql;
			}
			set
			{
				this.sql = value;
			}
		}
	}
}
